<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<title>祖龙娱乐  - BI系统</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .old {
            font-weight: bold !important;
            background-image: none !important;
            color: #000000 !important;
        }
    </style>
    <script type="text/javascript" src="../../js/highcharts.js"></script>
	<script type="text/javascript" src="../../js/drawChart.js"></script>
</h:head>

<h:body>
	<ui:param name="bean" value="#{gameReportAction}" />
	
	<span class="pagetitle">运营报表 —— CPS</span>
	<p:separator />
	
	<!-- 右侧页面顶部查询部分 -->
	<h:form id="fsearch">
        <h:outputLabel id="radioHide" value="#{bean.dateRadio}" style="visibility: hidden"/>

        <p:outputPanel id="customPanel" style="margin-bottom:10px">
            <p:selectOneRadio id="customRadio" value="#{bean.dateRadio}" layout="custom">
                <f:selectItem itemLabel="7" itemValue="7" />
                <f:selectItem itemLabel="15" itemValue="15" />
                <f:selectItem itemLabel="30" itemValue="30" />
                <f:selectItem itemLabel="0" itemValue="0" />
                <p:ajax update="radioHide customPanel :#{p:component('dform')}" listener="#{bean.radioChange}"/>
            </p:selectOneRadio>

            <h:panelGrid id="opt" columns="14" cellpadding="5">
                <p:radioButton id="opt1" for="customRadio" itemIndex="0" />
                <h:outputLabel for="opt1" value="近7天" />
                <h:outputLabel />

                <p:radioButton id="opt2" for="customRadio" itemIndex="1" />
                <h:outputLabel for="opt2" value="近15天" />
                <h:outputLabel />

                <p:radioButton id="opt3" for="customRadio" itemIndex="2" />
                <h:outputLabel for="opt3" value="近30天" />
                <h:outputLabel />

                <p:radioButton id="opt4" for="customRadio" itemIndex="3" />
                <h:outputLabel for="opt4" value="自定义 开始时间" />
                <p:calendar value="#{bean.dateStart}" mode="popup" pattern="yyyy-MM-dd">
                    <p:ajax event="dateSelect" listener="#{bean.spinnerChange}" update=":#{p:component('dform')}" onstart="return spinnered()" />
                </p:calendar>
                <h:outputLabel for="opt4" value="结束时间" />
                <p:calendar value="#{bean.dateEnd}" mode="popup" pattern="yyyy-MM-dd">
                    <p:ajax event="dateSelect" listener="#{bean.spinnerChange}" update=":#{p:component('dform')}" onstart="return spinnered()" />
                </p:calendar>
            </h:panelGrid>
        </p:outputPanel>
	</h:form>
	<br />

	<!-- 数据展示部分，包含表格和图表 -->
	<h:form id="dform">
        <script type="text/javascript">
            $('body').on('click', '.column', function() {
                var selected = $(this).hasClass("highlight");
                $(".column").removeClass("highlight");
                if(!selected) {
                    $(this).addClass("highlight");
                }
            });
        </script>

		<div class="data" id="data">
			<p:panel id="panel2" header="平台渠道详细数据" style="margin-bottom:10px;">
                <p:selectOneButton value="#{bean.selectedPlatform}">
                    <f:selectItem itemLabel="全部平台" itemValue="0" />
                    <f:selectItem itemLabel="ios正版" itemValue="2" />
                    <f:selectItem itemLabel="ios越狱" itemValue="1" />
                    <f:selectItem itemLabel="安卓" itemValue="3" />
                    <p:ajax update="panel2" listener="#{bean.selectPlatform}" />
                </p:selectOneButton>
                <br /><br />

                <p:dataTable id="dlist3" var="l" frozenColumns="1" scrollable="true" value="#{bean.cpsDataList}" resizableColumns="true" paginator="true" paginatorPosition="bottom" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="15" style="text-align:center;padding: 0;margin: 0;">
                    <f:facet name="header">
                        渠道汇总数据
                    </f:facet>
                    <f:facet name="{Exporters}">
                        <h:commandLink styleClass="exporter">
                            <p:graphicImage url="/resources/images/excel.png" height="25px" />
                            <p:dataExporter type="xls" target="dlist3" fileName="cpsdetail-#{pageHelper.getNewDateDetailStr()}" />
                        </h:commandLink>
                    </f:facet>
                    <p:column headerText="渠道" styleClass="column grcchannel" sortBy="#{pageHelper.getChannelNameById(l.channelId)}">
                        <h:outputLabel value="#{pageHelper.getChannelNameById(l.channelId)}" />
                    </p:column>
                    <p:column headerText="新增设备数" styleClass="column grcnewDevice" rendered="false">
                        <h:outputLabel value="#{l.newDevice}" />
                    </p:column>
                    <p:column headerText="激活设备数" styleClass="column grcnewDevice" sortBy="#{l.activeDevice}">
                        <h:outputLabel value="#{l.activeDevice}" />
                    </p:column>
                    <p:column headerText="新增帐号数" styleClass="column grcnewUser" sortBy="#{l.newUser}">
                        <h:outputLabel value="#{l.newUser}" />
                    </p:column>
                    <p:column headerText="活跃账号数" styleClass="column grcactiveUserCount" sortBy="#{l.activeUserCount}">
                        <h:outputLabel value="#{l.activeUserCount}" />
                    </p:column>
                    <p:column headerText="付费金额#{pageHelper.getMoneyType()}" styleClass="column grcpayCount" sortBy="#{l.payCount}">
                        <h:outputLabel value="#{l.payCount}" />
                    </p:column>
                    <p:column headerText="付费账号数" styleClass="column grcpayUserCount" sortBy="#{l.payUserCount}">
                        <h:outputLabel value="#{l.payUserCount}" />
                    </p:column>
                    <p:column headerText="活跃付费率" styleClass="column grcactivePayRadio" sortBy="#{l.activePayRadio}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.activePayRadio)}" />
                    </p:column>
                    <p:column headerText="付费ARPU" styleClass="column grcpayARPU" sortBy="#{l.payARPU}">
                        <h:outputLabel value="#{l.payARPU}" />
                    </p:column>
                    <p:column headerText="活跃ARPU" styleClass="column grcactiveARPU" sortBy="#{l.activeARPU}">
                        <h:outputLabel value="#{l.activeARPU}" />
                    </p:column>
                    <p:column headerText="人均在线时长(m)" styleClass="column grcavgOnlineTime" sortBy="#{l.avgOnlineTime}">
                        <h:outputLabel value="#{l.avgOnlineTime}" />
                    </p:column>
                    <p:column headerText="新增帐号次日留存率" styleClass="column grcthe2Left" sortBy="#{l.the2Left}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the2Left)}" />
                    </p:column>
                    <p:column headerText="新增帐号3日留存率" styleClass="column grcthe3Left" sortBy="#{l.the3Left}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the3Left)}" />
                    </p:column>
                    <p:column headerText="新增帐号7日留存率" styleClass="column grcthe7Left" sortBy="#{l.the7Left}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the7Left)}" />
                    </p:column>
                    <p:column headerText="新增帐号14日留存率" styleClass="column grcthe14Left" sortBy="#{l.the14Left}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the14Left)}" />
                    </p:column>
                    <p:column headerText="新增帐号30日留存率" styleClass="column grcthe30Left" sortBy="#{l.the30Left}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the30Left)}" />
                    </p:column>
                    <p:column headerText="有效新增用户数" styleClass="column grcvalidatedNewUser" sortBy="#{l.validatedNewUser}">
                        <h:outputLabel value="#{l.validatedNewUser}" />
                    </p:column>
                    <p:column headerText="登录比新增用户有效率" styleClass="column grcloginNewUservalidatedRadio" sortBy="#{l.loginNewUservalidatedRadio}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.loginNewUservalidatedRadio)}" />
                    </p:column>
                    <p:column headerText="登录比留存用户数" styleClass="column grcloginRadioAliveUserCount" sortBy="#{l.loginRadioAliveUserCount}">
                        <h:outputLabel value="#{l.loginRadioAliveUserCount}" />
                    </p:column>
                    <p:column headerText="一阶登录比" styleClass="column grcloginRadio" sortBy="#{l.loginRadio}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.loginRadio)}" />
                    </p:column>
                    <p:column headerText="二阶登录比" styleClass="column grcloginRadio" sortBy="#{l.loginRadio2}">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.loginRadio2)}" />
                    </p:column>
                    <p:column headerText="首次付费账号数" styleClass="column grcfirstPayUserCount"  rendered="false">
                        <h:outputLabel value="#{l.firstPayUserCount}" />
                    </p:column>
                    <p:column headerText="新增账号付费人数" styleClass="column grcnewPayUserCount" rendered="false">
                        <h:outputLabel value="#{l.newPayUserCount}" />
                    </p:column>
                    <p:column headerText="新增账号付费金额" styleClass="column grcnewUserPayCount" rendered="false">
                        <h:outputLabel value="#{l.newUserPayCount}" />
                    </p:column>
                    <p:column headerText="新增账号付费率" styleClass="column grcnewUserPayRatio" rendered="false">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.newUserPayRatio)}" />
                    </p:column>
                    <p:column headerText="新增账号付费ARPU" styleClass="column grcnewPayUserARPU" rendered="false">
                        <h:outputLabel value="#{l.newPayUserARPU}" />
                    </p:column>
                    <p:column headerText="7日LTV" styleClass="column grcthe7LTV" sortBy="#{l.the7LTV}">
                        <h:outputLabel value="#{l.the7LTV}" />
                    </p:column>
                    <p:column headerText="14日LTV" styleClass="column grcthe14LTV" sortBy="#{l.the14LTV}">
                        <h:outputLabel value="#{l.the14LTV}" />
                    </p:column>
                    <p:column headerText="30日LTV" styleClass="column grcthe30LTV" sortBy="#{l.the30LTV}">
                        <h:outputLabel value="#{l.the30LTV}" />
                    </p:column>
                </p:dataTable>
            </p:panel>
		</div>
	</h:form>

	<!-- 页脚 -->
	<div class="footer"></div>
</h:body>
</html>